#include <stdio.h>
#include <unistd.h>

int main()
{
    pid_t pid = fork();
    if(pid < 0)
    {
        printf("creat process failed\n");
        return 0;
    }
    else if(pid == 0)
    {
        //child
        printf("i am subprocess,pid:%d,my father pid is %d\n",getpid(),getppid());
    }
    else
    {
        //father 
        sleep(3);
        printf("i am father process,pid:%d,my father pid is %d\n",getpid(),getppid());
    }

    while(1)
    {}
    return 0;
}
